﻿using System;
using System.Data;
using System.Web.UI;

namespace 上课演示
{
    public partial class DATATABLEDEMO : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            var table = new DataTable();
            table.Columns.Add("Sno", typeof (string));
            table.Columns.Add("Sname", typeof (string));
            table.Columns.Add("Sage", typeof (int));

            DataRow row = table.NewRow();
            row["Sno"] = "95001";
            row["Sname"] = "Tom";
            row["Sage"] = 16;

            table.Rows.Add(row);

            row = table.NewRow();
            row["Sno"] = "95002";
            row["Sname"] = "Jane";
            row["Sage"] = 18;

            table.Rows.Add(row);

            table.Rows.RemoveAt(1);

            GridView1.DataSource = table;
            GridView1.DataBind();

            Response.Write("hello");
        }
    }
}